﻿@using Newtouch.Infrastructure;
@using Newtouch.HIS.Web.Core.Extensions;
@{
    ViewBag.Title = "MedicineInfo";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<style>
    .trSelected {
        background-color: #87CEEB !important;
    }

    #btn_search {
        height: 45px;
        width: 45px;
        background-color: #fff;
        color: #00a9ea;
        font-weight: bolder;
    }
</style>
<form id="form1">
    <div class="panel panel-default">
        <div class="panel-heading">
            药品筛选信息
        </div>
        <div>
            <table class="form" style="width:40%;">
                <tr>
                    <td class="formTitle">药品：</td>
                    <td class="formValue">
                        <input type="text" id="ypdm" class="form-control" placeholder="请输入药品代码 拼音 名称" />
                    </td>
                    <td class="formTitle">
                        <input type="button" class="btn btn-primary btn-md" id="btn_search" value="查询" style="height:70%"/>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="gridPanel" style="margin-top:10px">
        <table id="gridList"></table>
        <div id="gridPager" rel="form1"></div>
    </div>
   
</form>

<script>
    var $gridList = $("#gridList");
    var par = new Object();
    $(function () {
        gridList();
    });

    //回车事件绑定
    $(document).keyup(function (event) {
        if (event.keyCode === 13) {
            $("#btn_search").trigger("click");
        }
    });

    function gridList() {
        $gridList.dataGrid({
            url: "/PrepareMedicine/GetypGridJson",
            postData: $("#form1").formSerialize(),
            height: $(window).height() - 235,
            colModel: [
                { label: "主键", name: "kcId", hidden: true, key: true },
                { label: "ksbm", name: "ypdm", hidden: true },
                { label: "bqbm", name: "ypdm", hidden: true  },
                { label: "yfbmCode", name: "ypdm", hidden: true  },
                { label: "药品代码", name: "ypdm", width: 70, align: 'left' },
                { label: '药品名称', name: 'ypmc', width: 120, align: 'left' },
                { label: '科室名称', name: 'ksmc', width: 80, align: 'left' },
                { label: '病区名称', name: 'bqmc', width: 70, align: 'left' },
                { label: '药房名称', name: 'yfbmmc', width: 50, align: 'left' },
                { label: "批号", name: "ph", width: 80, align: 'left' },
                { label: "批次", name: "pc", width: 70, align: 'left' },
                { label: "库存数量", name: "kcsl", width: 50, align: 'left' },
                { label: "冻结数量", name: "djsl", width: 50, align: 'left' },
                { label: "退药标志", name: "tybz", width: 50, align: 'left' },
                { label: "进价", name: "jj", width: 50, align: 'left' },
                { label: "拆零数", name: "zhyz", width: 50, align: 'left' },
                { label: '产地目录', name: 'cd', width: 50, align: 'left' }
                //{ label: 'syzt', name: 'syzt', hidden: true }
            ],
            pager: "#gridPager",
            sortname: 'ypmc asc',
            viewrecords: true,
            gridComplete: function () {
                //afterCompleteFunction();
            }
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                url: "/PrepareMedicine/GetypGridJson?r=" + Math.random(),
                postData: $("#form1").formSerialize()
            }).trigger('reloadGrid');
        });
    }
    
</script>